package com.hcq.controller;

import com.common.entity.Rsp;
import com.common.entity.User;
import com.hcq.enm.TemplateCode;
import com.hcq.service.AliMsgServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AliMsgController {

    @Autowired
    AliMsgServiceImpl aliMsgService;

    /**
     * 发送短信验证码
     * @param user
     * @return
     */
    @PostMapping("/sendRegMsg")
    public Rsp sendRegMsg(@RequestBody User user){
        return aliMsgService.sendResult(user.getPhone(), TemplateCode.REG);
    }

    /**
     * 发送短信验证码
     * @param user
     * @return
     */
    @PostMapping("/sendLoginMsg")
    public Rsp sendLoginMsg(@RequestBody User user){
        return aliMsgService.sendResult(user.getPhone(), TemplateCode.LOGIN);
    }

    /**
     * 发送短信验证码
     * @param user
     * @return
     */
    @PostMapping("/sendResetMsg")
    public Rsp sendResetMsg(@RequestBody User user){
        return aliMsgService.sendResult(user.getPhone(), TemplateCode.RESET_PASSWORD);
    }


}
